package cn.zzp.org.domain;

import cn.zzp.basic.domain.BaseDomain;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName Department
 * @Description 部门管理实体类
 * @Author 祝志鹏
 * @Date 2022/7/14 12:51
 */
@ApiModel(description = "部门管理实体类")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Department extends BaseDomain {


    /**
     * 部门编号
     */
    @ApiModelProperty(value = "部门编号",required=true)
    private String sn;

    /**
     * 部门名称
     */
    @ApiModelProperty(value = "部门名称",required=true)
    private String name;

    /**
     * 上级部门路径 ex：/2/5/6
     */
    @ApiModelProperty(value = "上级部门路径",required=true)
    private String dirPath;

    /**
     * 状态
     */
    @ApiModelProperty(value = "状态",required=true)
    private Integer state;

    /**
     * 当前部门领导id
     */
    @ApiModelProperty(value = "当前部门领导id",required=true)
    private Long manager_id;
    // 关联查询 --> 一个部门领导id对应一个员工
    private Employee manager;

    /**
     * 上级部门id
     */
    @ApiModelProperty(value = "上级部门id",required=true)
    private Long parent_id;
    // 自关联查询 --> 一个父级部门id对应一个部门
    private Department parent;

    // 子级部门 --> 一个父级部门对应多个子级部门
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<Department> children = new ArrayList<>();
}
